import Vue from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import router from './router'
import store from './store'
import './assets/css/common.css'
//全局注册element-ui组件
import './element_import/index'

//引入接口
import api from './api/index'

Vue.prototype.$api=api;

Vue.config.productionTip = false

//刷新页面时，从本地获取数据，存储到vuex
let username = localStorage.getItem('egouser')
let token = localStorage.getItem('egotoken')
if(username){
  store.dispatch('setUserNameAction',username)
}
if(token){
  store.dispatch('setTokenAction',token)
}


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
